package com.loveofsoftware.fotolab.effects;

import android.graphics.Bitmap;
import android.graphics.Camera;
import android.graphics.Matrix;

public class DepthAndRotateByYEffect implements InitialEffects {

	public static float deg = 45;
	public static final float MAX_DEG = 180;
	float x, y;

	public DepthAndRotateByYEffect(float x, float y) {
		this.x = x;
		this.y = y;
	}

	public Bitmap transform(Bitmap in) {
		Matrix matrix = new Matrix();

		Camera camera = new Camera();
		camera.save();
		camera.translate(x, y, in.getHeight());
		camera.rotateY(deg);
		camera.getMatrix(matrix);
		camera.restore();

		in = Bitmap.createBitmap(in, 0, 0, in.getWidth(), in.getHeight(),
				matrix, true);
		return in;
	}
}
